package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

@Controller
public class PayController {

    @Resource
    private OrderFeignClient orderFeignClient;
    //转发到支付页面去
    @GetMapping("/pay.html")
    public String pay(Long orderId, Model model){

        //查询订单信息  总金额
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",orderInfo);

        return "payment/pay";
    }
    //转发到支付成功页面
    @GetMapping("/pay/success.html")
    public String success(){
        System.out.println("支付宝来过了转发页面");
        return "payment/success";
    }
}